(use-package cc-mode
  :ensure
  :bind
  (:map c-mode-base-map
        ("C-i" . starsoul-tab)
        ("C-j" . electric-indent-just-newline) ;;使用^C-j换行不自动缩进
        ("C-c C-c" . comment-or-uncomment-region))
  :config
  (add-hook 'c-mode-common-hook 'xwos-make-newline-indent)
  (add-hook 'c-mode-hook 'xwos-set-c-style)
  (add-hook 'c-mode-hook 'xwos-c-mode-hook)
  (add-hook 'c++-mode-hook 'xwos-set-c++-style)
  (add-hook 'c++-mode-hook 'xwos-c++-mode-hook))

(require 'xwos-c-style)
(require 'xwos-c++-style)

(defun xwos-c-mode-hook ()
  ;; (lsp)
  (setq fci-rule-column 88)
  (setq tab-width 8)
  (c-toggle-hungry-state 1)
  (electric-indent-mode 1))

(defun xwos-c++-mode-hook ()
  ;; (lsp)
  (setq fci-rule-column 100)
  (setq tab-width 4)
  (c-toggle-hungry-state 1)
  (electric-indent-mode 1))

(provide 'init_cc-mode)
